package com.tony.pmp.server.controller;

import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created with IntelliJ IDEA.
 *
 * @Title: SysPagecontroller
 * @Auther: 皮蛋布丁
 * @Date: 2021/07/11/13:32
 * @Description: 基础页面跳转
 */
@Controller
public class SysPagecontroller {

    /**
    * @Description: page 菜单的公共跳转接口
    * @Param: [module, page]
    * @return: java.lang.String
    * @Author: 皮蛋布丁
    * @Date: 2021/7/14 22:53
    */
    @RequestMapping("modules/{module}/{page}.html")
    public String page(@PathVariable String module,@PathVariable String page) {
        return "modules/" + module + "/" + page;
    }

    @RequestMapping(value = {"index.html","/"})
    public String index() {
        return "index";
    }

    @RequestMapping("/login.html")
    public String login() {
        //当前用户已登录
        if (SecurityUtils.getSubject().isAuthenticated()){
            return "redirect:index.html";
        }
        return "login";
    }

    @RequestMapping("/main.html")
    public String main() {
        return "main";
    }

    @RequestMapping("/404.html")
    public String notFund() {
        return "404";
    }


}
